package javacafe.action.study;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import javacafe.action.Action;
import javacafe.action.ActionForward;
import javacafe.dto.member.LoginInfoDTO;
import javacafe.dto.study.StudyMemberDTO;
import javacafe.service.StudyService;
import javacafe.serviceimple.StudyServiceImpl;

public class WithdrawalStudyMemberAction implements Action {

	@Override
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) {

		if (((LoginInfoDTO)request.getSession().getAttribute("loginInfo")) != null) {
			StudyService studyService = StudyServiceImpl.getInstance();
			int m_no = ((LoginInfoDTO)request.getSession().getAttribute("loginInfo")).getM_no();
			int study_no = Integer.parseInt(request.getParameter("study_no"));
			studyService.withdrawalMember(m_no, study_no);
		}
		
		ActionForward forward = new ActionForward();
		forward.setUrl("index");
		
		return forward;
	}

}
